﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/MasterPage.master" AutoEventWireup="true"
    CodeFile="PublishNews.aspx.cs" Inherits="UserPower_PublishNews" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TabTitle" runat="Server">
    <%= Resources.Resource.InformationPublish%><%--信息发布--%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <script type="text/ecmascript">
        function check() {
            //if (document.getElementById("HiddenReceiver").value != "")
            //   document.getElementById('<%=TextBoxReceiver.ClientID %>').value = document.getElementById("HiddenReceiver").value;
            var hidden = document.getElementById('HiddenReceiver');
            var receivertext = document.getElementById('<%=TextBoxReceiver.ClientID %>');
            var receiver = receivertext.value.substring(receivertext.value.length - 1);
            var arr_hidden = new Array();
            var arr_text = new Array();
            if (hidden.value != "") {
                if (receivertext.value != "" && receiver == ";") {
                    arr_hidden = hidden.value.split(";");
                    arr_text = receivertext.value.split(";");
                    for (var i = 0; i < arr_text.length; i++) {
                        for (var j = 0; j < arr_hidden.length; j++) {
                            if (arr_text[i] == arr_hidden[j]) {

                                arr_hidden.splice(j, 1);
                            }
                        }
                    }
                    receivertext.value += arr_hidden.join(";");
                }
                else {
                    if (receivertext.value != "" && receiver != ";") {
                        receivertext.value += ";";
                        arr_hidden = hidden.value.split(";");
                        arr_text = receivertext.value.split(";");
                        for (var i = 0; i < arr_text.length; i++) {
                            for (var j = 0; j < arr_hidden.length; j++) {
                                if (arr_text[i] == arr_hidden[j]) {

                                    arr_hidden.splice(j, 1);
                                }
                            }

                        }
                        receivertext.value += arr_hidden.join(";");
                    }
                }
                if (receivertext.value == "") {
                    receivertext.value = hidden.value;
                }
            }
        }
        function checkfalse() {
            alert('<%= Resources.Resource.InformationMag1%>'); //请正确添写收件人！InformationMag1
        }
        function publishok() {

            alert('<%= Resources.Resource.InformationMag2%>'); //信息发布成功！
            // window.location.href= "NewsList.aspx"; 
        }
        function title_and_receiver_check() {
            var title = document.getElementById("<%=TextBoxtTitle.ClientID%>");
            var receiver = document.getElementById("<%=TextBoxReceiver.ClientID %>");
            if (title.value == "" || receiver.value == "") {
                alert('<%= Resources.Resource.InformationMag3%>'); //标题或收件人均不能为空！
                return false;
            }
            else {
                return true;
            }

        }
        function changeTime() {
            var date = new Date();
            var year = date.getYear();
            var month = date.getMonth() + 1;
            var day = date.getDate();
            var hour = date.getHours();
            var minu = date.getMinutes();
            month = month < 10 ? "0" + month : month;
            day = day < 10 ? "0" + day : day;
            hour = hour < 10 ? "0" + hour : hour;
            minu = minu < 10 ? "0" + minu : minu;
            this.document.getElementById("<%=Time.ClientID %>").innerHTML = year + "-" + month + "-" + day + " " + hour + ":" + minu + ""
        }
        window.setInterval("changeTime()", 1000);
    </script>
    <div style="width: 100%;">
        <div class="queryDiv1">
            <input id="Hidden1" type="hidden" />
            <input id="HiddenReceiver" type="hidden" />
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="divFrameHead">
                        <span class="querytextCss">
                            <%= Resources.Resource.PublishContent%><%--发布内容--%></span>
                    </td>
                </tr>
                <tr>
                    <td class="submitborder" style="padding-top: 15px; padding-bottom: 15px;">
                        <table style="margin-bottom: 10px;" width="95%" border="0" align="center" cellpadding="0"
                            cellspacing="0">
                            <tr>
                                <td class="submitborder4">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.InformationTitle%><%--信息标题--%>
                                            </td>
                                            <td align="left" colspan="3">
                                                <asp:TextBox ID="TextBoxtTitle" runat="server" Width="500" AutoCompleteType="Disabled"></asp:TextBox>
                                                &nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.Importance%><%--重要程度--%>
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList ID="DropdownImportant" runat="server">
                                                    <asp:ListItem Text="<%$ Resources:Resource,General%>"></asp:ListItem>
                                                    <%--一般--%>
                                                    <asp:ListItem Text="<%$ Resources:Resource,Important%>"></asp:ListItem>
                                                    <%--重要--%>
                                                    <asp:ListItem Text="<%$ Resources:Resource,Urgent%>"></asp:ListItem>
                                                    <%--紧急--%>
                                                </asp:DropDownList>
                                            </td>
                                            <td style="text-align: left;">
                                                <%= Resources.Resource.Publisher%><%--发布人--%>&nbsp;<%=this.UserName %>
                                            </td>
                                            <td align="left" style="width: 70%">
                                                <%= Resources.Resource.PublishTime%><%--发布时间--%>&nbsp<asp:Label ID="Time" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.Addressee%><%--收件人--%>
                                            </td>
                                            <td align="left" colspan="3">
                                                <asp:TextBox ID="TextBoxReceiver" runat="server" Width="500"></asp:TextBox>
                                                <a href="#" onclick="javascript:window.open('../Common/SelectReceiver.aspx','','width=500,height=500,top=100,left=500,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')">
                                                    <%= Resources.Resource.PleaseChooselinkman%><%--选择联系人--%></a>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <table width="100%">
            <tr>
                <td style="height: 300px">
                    <FCKeditorV2:FCKeditor ID="FCKeditor_News" runat="server" Height="290" Width="100%">
                    </FCKeditorV2:FCKeditor>
                </td>
            </tr>
            <tr>
                <td align="center">
                    <div>
                        <%--发布--%>
                        <asp:Button ID="ButtonPublishNews" runat="server" Text="<%$Resources:Resource,btnPublish%>"
                            OnClientClick="return title_and_receiver_check()" OnClick="ButtonPublishNews_Click" />
                    </div>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
